Skip to content

refactor(codegen): make Statement::Gen code more compact#10937

Merged
Boshen merged 1 commit intomainfrom
05-11-refactor_codegen_make_statement_gen_code_more_compact
May 11, 2025
Merged

refactor(codegen): make Statement::Gen code more compact#10937
Boshen merged 1 commit intomainfrom
05-11-refactor_codegen_make_statement_gen_code_more_compact

Conversation

@Boshen
Copy link
Member

@Boshen Boshen commented May 11, 2025

To improve instructions cache.

relates #10931

Copilot AI review requested due to automatic review settings May 11, 2025 05:22
@github-actions github-actions bot added A-codegen Area - Code Generation C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels May 11, 2025
Copy link
Member Author

Boshen commented May 11, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the code generation for various Statement variants to use a more compact syntax, aiming to improve the instructions cache.

  • Removed repetitive calls to p.print_statement_comments in many Statement match arms.
  • Streamlined multiple implementations to use a single-line expression where possible.
Comments suppressed due to low confidence (2)

crates/oxc_codegen/src/gen.rs:171

  • [nitpick] The ordering of p.print_statement_comments and p.print_indent for TS declarations has been changed compared to other Statement variants. Verify that printing the comments after indenting does not undesirably affect the output formatting.
Self::TSInterfaceDeclaration(decl) => { p.print_indent(); p.print_statement_comments(decl.span.start); ...

crates/oxc_codegen/src/gen.rs:114

  • The refactoring removes the call to p.print_statement_comments for several Statement variants (e.g. BreakStatement, ContinueStatement, etc.). Ensure that comments are still printed as intended, either by virtue of the delegated stmt.print(p, ctx) or by other means.
Self::BreakStatement(stmt) => stmt.print(p, ctx),

@codspeed-hq
Copy link

codspeed-hq bot commented May 11, 2025

CodSpeed Instrumentation Performance Report

Merging #10937 will not alter performance

Comparing 05-11-refactor_codegen_make_statement_gen_code_more_compact (064fd51) with main (b526da9)

Summary

✅ 36 untouched benchmarks

@Boshen Boshen merged commit 9225bde into main May 11, 2025
26 checks passed
@Boshen Boshen deleted the 05-11-refactor_codegen_make_statement_gen_code_more_compact branch May 11, 2025 05:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-codegen Area - Code Generation C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants